package com.cyys.modules.system.model.param;

import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableField;
import com.cyys.common.utils.StringUtil;
import com.cyys.modules.core.model.TreeBean;
import lombok.Data;

@Data
public class ParamRegion extends TreeBean<ParamRegion> {

	private String cityCode;
	@TableField(condition = SqlCondition.LIKE)
	private String name;
	private String shortName;
	private String zipCode;
	private String longitude;
	private String latitude;
	private Integer level;

	public String getCenter(){
		if(StringUtil.isNotBlank(this.getLongitude()) && StringUtil.isNotBlank(this.getLatitude())){
			return this.getLongitude()+","+this.getLatitude();
		}
		return "";
	}

   //========以下信息用于前端树节点暂时
	@TableField(exist = false)
	private boolean open; //是否展开，用于前端树节点显示
	@TableField(exist = false)
	private boolean isParent; //是否为父节点，用于前端树节点显示
	public boolean getIsParent(){
		return this.getHasChild()!=null && this.getHasChild()==1;
	}
}
